package com.xian.random;

import java.util.Random;

public class RandomDemo1 {
    public static void main(String[] args) {
        Random r = new Random();
        int count = 0;
        for (int i = 0; i < 20; i ++) {
            int data = r.nextInt(10);
            count++;
            System.out.println(data);
        }
        System.out.println(count);


        System.out.println("------------------------------");

        //1-10的随机数--减加法  1-10=== -1 ====》 （0-9）+1
        int dat = r.nextInt(10) + 1;
        System.out.println(dat);

        //3-17的随机数--减加法  3-17=== -3 ====》 （0-14）+3
        int da = r.nextInt(15) + 3;
        System.out.println(da);
    }

}
